<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistributionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //分销表
        Schema::create('distribution', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('first_user_id')->default(0)->comment('一级用户');
            $table->integer('secondary_user_id')->default(0)->comment('二级用户');
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::table('user_info', function (Blueprint $table) {
            $table->decimal('balance')->default(0)->comment('余额')->after('books_coin');
        });

        //提现表
        Schema::create('withdraw', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('提现的用户id');
            $table->decimal('amount')->default(0)->comment('提现金额');
            $table->integer('status')->default(0)->comment('成功或失败');
            $table->timestamp('review_time')->nullable()->comment('审核时间');
            $table->string('reason')->nullable()->comment('失败的原因');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
